#import <Foundation/Foundation.h>
#import <CoreMedia/CMSampleBuffer.h>

NS_ASSUME_NONNULL_BEGIN

@interface YHMovieRecorder : NSObject

/// 录制状态
@property (nonatomic, assign, readonly) BOOL isRecording;

/// 文件路径
@property (nonatomic,   copy, readonly) NSString *filePath;

/// 视频像素宽度
@property (nonatomic, assign, readonly) int videoWidth;

/// 视频像素高度
@property (nonatomic, assign, readonly) int videoHeight;

/// 音频采样率
@property (nonatomic, assign) NSInteger sampleRate;

/// 视频旋转角度
@property (nonatomic, assign) CGFloat rotation;

/// 录制已准备好的回调【录制时异步过程】
@property (nonatomic, copy, nullable) void(^recordPreparedBlock)(void);

/// 录制过程中出错的回调
@property (nonatomic, copy, nullable) void(^recordErrorOccuredBlock)(int errorCode);

/// 录制已完成的回调
@property (nonatomic, copy, nullable) void(^recordFinishedBlock)(void);

/// 开始录制视频
/// - Parameter filePath: 视频文件路径
- (void)startRecordWithFilePath:(NSString *)filePath;

/// 停止录制视频
- (void)stopRecord;

/// 实时预览录制使用下列两个方法
- (void)writePixelBuffer:(CVPixelBufferRef)pixelBuffer;
- (void)writePCMBuffer:(NSData *)pcmData;


/// 扩展方法，仅供参考
- (void)writePixelBuffer:(CVPixelBufferRef)pixelBuffer pts:(CMTime)pts;
- (void)writePixelBuffer:(CVPixelBufferRef)pixelBuffer ts:(uint64_t)ts;
- (void)writeVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer;
- (void)writeAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer;




@end

NS_ASSUME_NONNULL_END
